
/*
 * @(#)MaintDmsUpdateAlertForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.dms.web;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.alert.core.DocumentInvitationBean;
import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.GlobalConstant;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.Utility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;
import com.dcivision.user.bean.UserGroup;
import com.dcivision.user.bean.UserRecord;
import com.dcivision.user.bean.UserRole;

/**
  MaintDmsUpdateAlertForm.java

  This class is the for web form purpose.

  @author      barbin
  @company     DCIVision Limited
  @creation date   26/11/2006
  @version     $Revision: 1.3.6.2 $
*/

public class MaintDmsInvitationForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.3.6.2 $";

  private String alertTime = null;
  private String alertTimeType = null;
  private String status = null;
  private String recurEvent = null;
  private String readFlag = null;
  private String docID = null;
  private String invitationID = null;
  private String message = null;
  private String subject = null;
  private String externalInvitee = null;

  private String[] userList = null;
  private String[] groupList = null;
  private String[] roleList = null;

  //For display Document
  private String parentID = null;
  private String rootID = null;
  private String documentType = null;
  private String directURL=null;
  private String dueDate = null;
  private String updateDueDate = null;
  
  private String notifyWay = null;
  
  private String externalSubject = null;  
  private String priority = GlobalConstant.PRIORITY_MEDIUM;
  private String effectiveStartDate = null;
  private String effectiveEndDate = null;
  private String userDef1 = null;
  private String userDef2 = null;
  private String userDef3 = null;
  private String userDef4 = null;
  private String userDef5 = null;
  private String userDef6 = null;
  private String userDef7 = null;
  private String userDef8 = null;
  private String userDef9 = null;
  private String userDef10 = null;
  
  private String sortAttribute = "CREATE_DATE";
  private String sortOrder = "DESC";
  private String curStartRowNo = "1";

  public String getSortAttribute() {
	return sortAttribute;
}

public void setSortAttribute(String sortAttribute) {
	this.sortAttribute = sortAttribute;
}

public String getSortOrder() {
	return sortOrder;
}

public void setSortOrder(String sortOrder) {
	this.sortOrder = sortOrder;
}

public String getUserDef1() {
	return userDef1;
}

public void setUserDef1(String userDef1) {
	this.userDef1 = userDef1;
}

public String getUserDef10() {
	return userDef10;
}

public void setUserDef10(String userDef10) {
	this.userDef10 = userDef10;
}

public String getUserDef2() {
	return userDef2;
}

public void setUserDef2(String userDef2) {
	this.userDef2 = userDef2;
}

public String getUserDef3() {
	return userDef3;
}

public void setUserDef3(String userDef3) {
	this.userDef3 = userDef3;
}

public String getUserDef4() {
	return userDef4;
}

public void setUserDef4(String userDef4) {
	this.userDef4 = userDef4;
}

public String getUserDef5() {
	return userDef5;
}

public void setUserDef5(String userDef5) {
	this.userDef5 = userDef5;
}

public String getUserDef6() {
	return userDef6;
}

public void setUserDef6(String userDef6) {
	this.userDef6 = userDef6;
}

public String getUserDef7() {
	return userDef7;
}

public void setUserDef7(String userDef7) {
	this.userDef7 = userDef7;
}

public String getUserDef8() {
	return userDef8;
}

public void setUserDef8(String userDef8) {
	this.userDef8 = userDef8;
}

public String getUserDef9() {
	return userDef9;
}

public void setUserDef9(String userDef9) {
	this.userDef9 = userDef9;
}

public String getEffectiveEndDate() {
	return effectiveEndDate;
}

public void setEffectiveEndDate(String effectiveEndDate) {
	this.effectiveEndDate = effectiveEndDate;
}

public String getEffectiveStartDate() {
	return effectiveStartDate;
}

public void setEffectiveStartDate(String effectiveStartDate) {
	this.effectiveStartDate = effectiveStartDate;
}

public String getPriority() {
	return priority;
}

public void setPriority(String priority) {
	this.priority = priority;
}

public MaintDmsInvitationForm() {
    super();
  }

  public String getAlertTime() {
    return(this.alertTime);
  }

  public void setAlertTime(String alertTime) {
    this.alertTime = alertTime;
  }

  public String getAlertTimeType() {
    return(this.alertTimeType);
  }

  public void setAlertTimeType(String alertTimeType) {
    this.alertTimeType = alertTimeType;
  }


  public String getStatus() {
    return(this.status);
  }

  public void setStatus(String status) {
    this.status = status;
  }

  public String getRecurEvent() {
    return(this.recurEvent);
  }

  public void setRecurEvent(String recurEvent) {
    this.recurEvent = recurEvent;
  }

  public String getReadFlag() {
    return(this.readFlag);
  }

  public void setReadFlag(String readFlag) {
    this.readFlag = readFlag;
  }

  public String getParentID() {
    return(this.parentID);
  }

  public void setParentID(String parentID) {
    this.parentID = parentID;
  }

  public String getRootID() {
    return(this.rootID);
  }

  public void setRootID(String rootID) {
    this.rootID = rootID;
  }

  public String getDocumentType() {
    return(this.documentType);
  }

  public void setDocumentType(String documentType) {
    this.documentType = documentType;
  }
  
  public String getDirectURL(){
    return this.directURL;
  }
  
  public void setDirectURL(String directURL){
    this.directURL=directURL; 
  }
  
  public void setExternalSubject(String externalSubject){
    this.externalSubject = externalSubject;
  }
  
  public String getExternalSubject(){
    return this.externalSubject;
  }
    

  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return null;
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    
  }

 
  

	public String[] getGroupList() {
		return groupList;
	}
	
	public void setGroupList(String[] groupList) {
		this.groupList = groupList;
	}
	
	public String[] getRoleList() {
		return roleList;
	}
	
	public void setRoleList(String[] roleList) {
		this.roleList = roleList;
	}
	
	public String[] getUserList() {
		return userList;
	}
	
	public void setUserList(String[] userList) {
		this.userList = userList;
	}
	
	public String getDocID() {
		return docID;
	}
	
	public void setDocID(String docID) {
		this.docID = docID;
	}
	
	public String getDueDate() {
		return dueDate;
	}
	
	public void setDueDate(String dueDate) {
		this.dueDate = dueDate;
	}
	
	 public AbstractBaseObject getFormData() throws ApplicationException {
		return null;
     }
	 public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
		 
	 }
    public void setFormData(Object baseObj) throws ApplicationException {
    	DocumentInvitationBean invitationBean = (DocumentInvitationBean)baseObj;
    	String[] userList = null;
    	String[] groupList = null;
    	String[] roleList = null;
    	List user = invitationBean.getUser();
    	if(!Utility.isEmpty(user)){
    		userList = new String[user.size()];
    		for(int i=0; i<user.size();  i++){
	    	  UserRecord userRecord = (UserRecord)user.get(i);
	    	  userList[i]= userRecord.getID().toString();
	        }
    	}
    	List group = invitationBean.getGroup();
    	if(!Utility.isEmpty(group)){
    		groupList = new String[group.size()];
    		for(int i=0; i<group.size();  i++){
	      	  UserGroup userGroup = (UserGroup)group.get(i);
	      	  groupList[i]= userGroup.getID().toString();
    	     }
    	}
    	List role = invitationBean.getRole();
    	if(!Utility.isEmpty(role)){
    		roleList = new String[role.size()];
    		for(int i=0; i<role.size();  i++){
	          UserRole userRole = (UserRole)role.get(i);
	          roleList[i]= userRole.getID().toString();
    	    }
    	}
    	
    	List email = invitationBean.getExternalEmail();
    	StringBuffer sb = new StringBuffer();
    	if(!Utility.isEmpty(email)){
    		for(int i=0; i<email.size(); i++){
    			String emailAddress = (String)email.get(i);
    			sb.append(emailAddress+";");
    		}
    	}
    	if(!Utility.isEmpty(sb.toString())){
    		this.setExternalInvitee(sb.toString());	
    	}
    	this.setMessage(invitationBean.getMessage());
    	this.setSubject(invitationBean.getSubject());
    	this.setDueDate(TextUtility.formatTimestampToDate(invitationBean.getDueDate()));
    	this.setUserList(userList);
    	this.setGroupList(groupList);
    	this.setRoleList(roleList);
    }

	public String getUpdateDueDate() {
		return updateDueDate;
	}

	public void setUpdateDueDate(String updateDueDate) {
		this.updateDueDate = updateDueDate;
	}

	public String getCurStartRowNo() {
		return curStartRowNo;
	}

	public void setCurStartRowNo(String curStartRowNo) {
		this.curStartRowNo = curStartRowNo;
	}

	public String getInvitationID() {
		return invitationID;
	}

	public void setInvitationID(String invitationID) {
		this.invitationID = invitationID;
	}

	public String getExternalInvitee() {
		return externalInvitee;
	}

	public void setExternalInvitee(String externalInvitee) {
		this.externalInvitee = externalInvitee;
	}

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public String getSubject() {
		return subject;
	}

	public void setSubject(String subject) {
		this.subject = subject;
	}

  public String getNotifyWay() {
    return notifyWay;
  }

  public void setNotifyWay(String notifyWay) {
    this.notifyWay = notifyWay;
  }
	
}
